
package com.jf.cloud.api.leaf.dto;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.ArrayList;
import java.util.List;

/**
 * 分布式id请求参数
 *
 * @author zz
 * @date 2022-08-17 15:25:19
 */
public class SegmentDTO {

    @Schema(description = "id" )
    private Long id;

    @Schema(description = "用户id" )
    private List<SegmentItemDTO> segmentItemList;

    public SegmentDTO() {
    }

    public SegmentDTO(Long id, List<SegmentItemDTO> segmentItemList) {
        this.id = id;
        this.segmentItemList = segmentItemList;
    }

    public SegmentDTO(Long id, String key) {
        this.id = id;
        List<SegmentItemDTO> list = new ArrayList<>();
        list.add(new SegmentItemDTO(key, 1));
        this.segmentItemList = list;
    }

    public SegmentDTO(Long id, String key, Integer count) {
        this.id = id;
        List<SegmentItemDTO> list = new ArrayList<>();
        list.add(new SegmentItemDTO(key, count));
        this.segmentItemList = list;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<SegmentItemDTO> getSegmentItemList() {
        return segmentItemList;
    }

    public void setSegmentItemList(List<SegmentItemDTO> segmentItemList) {
        this.segmentItemList = segmentItemList;
    }

    @Override
    public String toString() {
        return "SegmentDTO{" +
                "id=" + id +
                ", segmentItemList=" + segmentItemList +
                '}';
    }
}
